﻿using System.ComponentModel;
using System.Windows.Threading;

namespace CI.Misc
{
    public class DataModel : INotifyPropertyChanged
    {
        protected Dispatcher UIDispatcher;
        public event PropertyChangedEventHandler PropertyChanged;

        protected DataModel()
        {
            UIDispatcher = Dispatcher.CurrentDispatcher;
        }

        protected void RaisePropertyChanged(string propertyName)
        {
            if ((PropertyChanged != null) && (!string.IsNullOrEmpty(propertyName)))
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        protected void RaisePropertyChanged(PropertyChangedEventArgs propertyChangedEventArgs)
        {
            if ((PropertyChanged != null) && (propertyChangedEventArgs != null))
            {
                PropertyChanged(this, propertyChangedEventArgs);
            }
        }
    }
}